#include "calculation.h"
#include <math.h>
#include "struct.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>

Calculation::Calculation()
{

}

Calculation::~Calculation()
{

}

float Calculation::QueteletIndexCalculation(struct UserData *data)
{
    float fResult; //Functions as the result of the calculated quetelet index.
    fResult = data->iweight/pow(data->flenght,2); //The pow function is a standard math function that can be used by using the math.h library
    return fResult;
}

void Calculation::ConvertQueteletIndexToString(float fIndex, char *pcQueteletIndex)
{

    if(fIndex < UNDERWEIGHTMARGIN_QI)
    {
        strcpy(pcQueteletIndex, "Underweight");
    }
    else if (fIndex > OVERWEIGHTMARGIN_QI)
    {
        strcpy(pcQueteletIndex, "Overweight");
    }
    else
    {
        strcpy(pcQueteletIndex, "Healthy weight");
    }
}
